home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 March / maximum-cd-2000-03.iso / Quake3 Game Source / Q3AGameSource.exe / Main / ui_video.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  31.3 KB  |  1,047 lines

  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3. #include "ui_local.h"
  4.  
  5. void GraphicsOptions_MenuInit( void );
  6.  
  7. /*
  8. =======================================================================
  9.  
  10. DRIVER INFORMATION MENU
  11.  
  12. =======================================================================
  13. */
  14.  
  15.  
  16. #define DRIVERINFO_FRAMEL    "menu/art/frame2_l"
  17. #define DRIVERINFO_FRAMER    "menu/art/frame1_r"
  18. #define DRIVERINFO_BACK0    "menu/art/back_0"
  19. #define DRIVERINFO_BACK1    "menu/art/back_1"
  20.  
  21. static char* driverinfo_artlist[] = 
  22. {
  23.     DRIVERINFO_FRAMEL,
  24.     DRIVERINFO_FRAMER,
  25.     DRIVERINFO_BACK0,
  26.     DRIVERINFO_BACK1,
  27.     NULL,
  28. };
  29.  
  30. #define ID_DRIVERINFOBACK    100
  31.  
  32. typedef struct
  33. {
  34.     menuframework_s    menu;
  35.     menutext_s        banner;
  36.     menubitmap_s    back;
  37.     menubitmap_s    framel;
  38.     menubitmap_s    framer;
  39.     char            stringbuff[1024];
  40.     char*            strings[64];
  41.     int                numstrings;
  42. } driverinfo_t;
  43.  
  44. static driverinfo_t    s_driverinfo;
  45.  
  46. /*
  47. =================
  48. DriverInfo_Event
  49. =================
  50. */
  51. static void DriverInfo_Event( void* ptr, int event )
  52. {
  53.     if (event != QM_ACTIVATED)
  54.         return;
  55.  
  56.     switch (((menucommon_s*)ptr)->id)
  57.     {
  58.         case ID_DRIVERINFOBACK:
  59.             UI_PopMenu();
  60.             break;
  61.     }
  62. }
  63.  
  64. /*
  65. =================
  66. DriverInfo_MenuDraw
  67. =================
  68. */
  69. static void DriverInfo_MenuDraw( void )
  70. {
  71.     int    i;
  72.     int    y;
  73.  
  74.     Menu_Draw( &s_driverinfo.menu );
  75.  
  76.     UI_DrawString( 320, 80, "VENDOR", UI_CENTER|UI_SMALLFONT, color_red );
  77.     UI_DrawString( 320, 152, "PIXELFORMAT", UI_CENTER|UI_SMALLFONT, color_red );
  78.     UI_DrawString( 320, 192, "EXTENSIONS", UI_CENTER|UI_SMALLFONT, color_red );
  79.  
  80.     UI_DrawString( 320, 80+16, uis.glconfig.vendor_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
  81.     UI_DrawString( 320, 96+16, uis.glconfig.version_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
  82.     UI_DrawString( 320, 112+16, uis.glconfig.renderer_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
  83.     UI_DrawString( 320, 152+16, va ("color(%d-bits) Z(%d-bits) stencil(%d-bits)", uis.glconfig.colorBits, uis.glconfig.depthBits, uis.glconfig.stencilBits), UI_CENTER|UI_SMALLFONT, text_color_normal );
  84.  
  85.     // double column
  86.     y = 192+16;
  87.     for (i=0; i<s_driverinfo.numstrings/2; i++) {
  88.         UI_DrawString( 320-4, y, s_driverinfo.strings[i*2], UI_RIGHT|UI_SMALLFONT, text_color_normal );
  89.         UI_DrawString( 320+4, y, s_driverinfo.strings[i*2+1], UI_LEFT|UI_SMALLFONT, text_color_normal );
  90.         y += SMALLCHAR_HEIGHT;
  91.     }
  92.  
  93.     if (s_driverinfo.numstrings & 1)
  94.         UI_DrawString( 320, y, s_driverinfo.strings[s_driverinfo.numstrings-1], UI_CENTER|UI_SMALLFONT, text_color_normal );
  95. }
  96.  
  97. /*
  98. =================
  99. DriverInfo_Cache
  100. =================
  101. */
  102. void DriverInfo_Cache( void )
  103. {
  104.     int    i;
  105.  
  106.     // touch all our pics
  107.     for (i=0; ;i++)
  108.     {
  109.         if (!driverinfo_artlist[i])
  110.             break;
  111.         trap_R_RegisterShaderNoMip(driverinfo_artlist[i]);
  112.     }
  113. }
  114.  
  115. /*
  116. =================
  117. UI_DriverInfo_Menu
  118. =================
  119. */
  120. static void UI_DriverInfo_Menu( void )
  121. {
  122.     char*    eptr;
  123.     int        i;
  124.     int        len;
  125.  
  126.     // zero set all our globals
  127.     memset( &s_driverinfo, 0 ,sizeof(driverinfo_t) );
  128.  
  129.     DriverInfo_Cache();
  130.  
  131.     s_driverinfo.menu.fullscreen = qtrue;
  132.     s_driverinfo.menu.draw       = DriverInfo_MenuDraw;
  133.  
  134.     s_driverinfo.banner.generic.type  = MTYPE_BTEXT;
  135.     s_driverinfo.banner.generic.x      = 320;
  136.     s_driverinfo.banner.generic.y      = 16;
  137.     s_driverinfo.banner.string          = "DRIVER INFO";
  138.     s_driverinfo.banner.color          = color_white;
  139.     s_driverinfo.banner.style          = UI_CENTER;
  140.  
  141.     s_driverinfo.framel.generic.type  = MTYPE_BITMAP;
  142.     s_driverinfo.framel.generic.name  = DRIVERINFO_FRAMEL;
  143.     s_driverinfo.framel.generic.flags = QMF_INACTIVE;
  144.     s_driverinfo.framel.generic.x      = 0;
  145.     s_driverinfo.framel.generic.y      = 78;
  146.     s_driverinfo.framel.width            = 256;
  147.     s_driverinfo.framel.height        = 329;
  148.  
  149.     s_driverinfo.framer.generic.type  = MTYPE_BITMAP;
  150.     s_driverinfo.framer.generic.name  = DRIVERINFO_FRAMER;
  151.     s_driverinfo.framer.generic.flags = QMF_INACTIVE;
  152.     s_driverinfo.framer.generic.x      = 376;
  153.     s_driverinfo.framer.generic.y      = 76;
  154.     s_driverinfo.framer.width            = 256;
  155.     s_driverinfo.framer.height        = 334;
  156.  
  157.     s_driverinfo.back.generic.type       = MTYPE_BITMAP;
  158.     s_driverinfo.back.generic.name     = DRIVERINFO_BACK0;
  159.     s_driverinfo.back.generic.flags    = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
  160.     s_driverinfo.back.generic.callback = DriverInfo_Event;
  161.     s_driverinfo.back.generic.id       = ID_DRIVERINFOBACK;
  162.     s_driverinfo.back.generic.x           = 0;
  163.     s_driverinfo.back.generic.y           = 480-64;
  164.     s_driverinfo.back.width             = 128;
  165.     s_driverinfo.back.height             = 64;
  166.     s_driverinfo.back.focuspic         = DRIVERINFO_BACK1;
  167.  
  168.     strcpy( s_driverinfo.stringbuff, uis.glconfig.extensions_string );
  169.  
  170.     // build null terminated extension strings
  171.     eptr = s_driverinfo.stringbuff;
  172.     while ( s_driverinfo.numstrings<40 && *eptr )
  173.     {
  174.         while ( *eptr && *eptr == ' ' )
  175.             *eptr++ = '\0';
  176.  
  177.         // track start of valid string
  178.         if (*eptr && *eptr != ' ')
  179.             s_driverinfo.strings[s_driverinfo.numstrings++] = eptr;
  180.  
  181.         while ( *eptr && *eptr != ' ' )
  182.             eptr++;
  183.     }
  184.  
  185.     // safety length strings for display
  186.     for (i=0; i<s_driverinfo.numstrings; i++) {
  187.         len = strlen(s_driverinfo.strings[i]);
  188.         if (len > 32) {
  189.             s_driverinfo.strings[i][len-1] = '>';
  190.             s_driverinfo.strings[i][len]   = '\0';
  191.         }
  192.     }
  193.  
  194.     Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.banner );
  195.     Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framel );
  196.     Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framer );
  197.     Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.back );
  198.  
  199.     UI_PushMenu( &s_driverinfo.menu );
  200. }
  201.  
  202. /*
  203. =======================================================================
  204.  
  205. GRAPHICS OPTIONS MENU
  206.  
  207. =======================================================================
  208. */
  209.  
  210. #define GRAPHICSOPTIONS_FRAMEL    "menu/art/frame2_l"
  211. #define GRAPHICSOPTIONS_FRAMER    "menu/art/frame1_r"
  212. #define GRAPHICSOPTIONS_BACK0    "menu/art/back_0"
  213. #define GRAPHICSOPTIONS_BACK1    "menu/art/back_1"
  214. #define GRAPHICSOPTIONS_ACCEPT0    "menu/art/accept_0"
  215. #define GRAPHICSOPTIONS_ACCEPT1    "menu/art/accept_1"
  216.  
  217. static const char *s_drivers[] =
  218. {
  219.     OPENGL_DRIVER_NAME,
  220.     _3DFX_DRIVER_NAME,
  221.     0
  222. };
  223.  
  224. #define ID_BACK2        101
  225. #define ID_FULLSCREEN    102
  226. #define ID_LIST            103
  227. #define ID_MODE            104
  228. #define ID_DRIVERINFO    105
  229. #define ID_GRAPHICS        106
  230. #define ID_DISPLAY        107
  231. #define ID_SOUND        108
  232. #define ID_NETWORK        109
  233.  
  234. typedef struct {
  235.     menuframework_s    menu;
  236.  
  237.     menutext_s        banner;
  238.     menubitmap_s    framel;
  239.     menubitmap_s    framer;
  240.  
  241.     menutext_s        graphics;
  242.     menutext_s        display;
  243.     menutext_s        sound;
  244.     menutext_s        network;
  245.  
  246.     menulist_s        list;
  247.     menulist_s        mode;
  248.     menulist_s        driver;
  249.     menuslider_s    tq;
  250.     menulist_s      fs;
  251.     menulist_s      lighting;
  252.     menulist_s      allow_extensions;
  253.     menulist_s      texturebits;
  254.     menulist_s      colordepth;
  255.     menulist_s      geometry;
  256.     menulist_s      filter;
  257.     menutext_s        driverinfo;
  258.  
  259.     menubitmap_s    apply;
  260.     menubitmap_s    back;
  261. } graphicsoptions_t;
  262.  
  263. typedef struct
  264. {
  265.     int mode;
  266.     qboolean fullscreen;
  267.     int tq;
  268.     int lighting;
  269.     int colordepth;
  270.     int texturebits;
  271.     int geometry;
  272.     int filter;
  273.     int driver;
  274.     qboolean extensions;
  275. } InitialVideoOptions_s;
  276.  
  277. static InitialVideoOptions_s    s_ivo;
  278. static graphicsoptions_t        s_graphicsoptions;    
  279.  
  280. static InitialVideoOptions_s s_ivo_templates[] =
  281. {
  282.     {
  283.         4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue    // JDC: this was tq 3
  284.     },
  285.     {
  286.         3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue
  287.     },
  288.     {
  289.         2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue
  290.     },
  291.     {
  292.         2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue
  293.     },
  294.     {
  295.         3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue
  296.     }
  297. };
  298.  
  299. #define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) )
  300.  
  301. /*
  302. =================
  303. GraphicsOptions_GetInitialVideo
  304. =================
  305. */
  306. static void GraphicsOptions_GetInitialVideo( void )
  307. {
  308.     s_ivo.colordepth  = s_graphicsoptions.colordepth.curvalue;
  309.     s_ivo.driver      = s_graphicsoptions.driver.curvalue;
  310.     s_ivo.mode        = s_graphicsoptions.mode.curvalue;
  311.     s_ivo.fullscreen  = s_graphicsoptions.fs.curvalue;
  312.     s_ivo.extensions  = s_graphicsoptions.allow_extensions.curvalue;
  313.     s_ivo.tq          = s_graphicsoptions.tq.curvalue;
  314.     s_ivo.lighting    = s_graphicsoptions.lighting.curvalue;
  315.     s_ivo.geometry    = s_graphicsoptions.geometry.curvalue;
  316.     s_ivo.filter      = s_graphicsoptions.filter.curvalue;
  317.     s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue;
  318. }
  319.  
  320. /*
  321. =================
  322. GraphicsOptions_CheckConfig
  323. =================
  324. */
  325. static void GraphicsOptions_CheckConfig( void )
  326. {
  327.     int i;
  328.  
  329.     for ( i = 0; i < NUM_IVO_TEMPLATES; i++ )
  330.     {
  331.         if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue )
  332.             continue;
  333.         if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue )
  334.             continue;
  335.         if ( s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue )
  336.             continue;
  337.         if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue )
  338.             continue;
  339.         if ( s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue )
  340.             continue;
  341.         if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue )
  342.             continue;
  343.         if ( s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue )
  344.             continue;
  345.         if ( s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue )
  346.             continue;
  347. //        if ( s_ivo_templates[i].texturebits != s_graphicsoptions.texturebits.curvalue )
  348. //            continue;
  349.         s_graphicsoptions.list.curvalue = i;
  350.         return;
  351.     }
  352.     s_graphicsoptions.list.curvalue = 4;
  353. }
  354.  
  355. /*
  356. =================
  357. GraphicsOptions_UpdateMenuItems
  358. =================
  359. */
  360. static void GraphicsOptions_UpdateMenuItems( void )
  361. {
  362.     if ( s_graphicsoptions.driver.curvalue == 1 )
  363.     {
  364.         s_graphicsoptions.fs.curvalue = 1;
  365.         s_graphicsoptions.fs.generic.flags |= QMF_GRAYED;
  366.         s_graphicsoptions.colordepth.curvalue = 1;
  367.     }
  368.     else
  369.     {
  370.         s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED;
  371.     }
  372.  
  373.     if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 )
  374.     {
  375.         s_graphicsoptions.colordepth.curvalue = 0;
  376.         s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED;
  377.     }
  378.     else
  379.     {
  380.         s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED;
  381.     }
  382.  
  383.     if ( s_graphicsoptions.allow_extensions.curvalue == 0 )
  384.     {
  385.         if ( s_graphicsoptions.texturebits.curvalue == 0 )
  386.         {
  387.             s_graphicsoptions.texturebits.curvalue = 1;
  388.         }
  389.     }
  390.  
  391.     s_graphicsoptions.apply.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
  392.  
  393.     if ( s_ivo.mode != s_graphicsoptions.mode.curvalue )
  394.     {
  395.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  396.     }
  397.     if ( s_ivo.fullscreen != s_graphicsoptions.fs.curvalue )
  398.     {
  399.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  400.     }
  401.     if ( s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue )
  402.     {
  403.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  404.     }
  405.     if ( s_ivo.tq != s_graphicsoptions.tq.curvalue )
  406.     {
  407.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  408.     }
  409.     if ( s_ivo.lighting != s_graphicsoptions.lighting.curvalue )
  410.     {
  411.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  412.     }
  413.     if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue )
  414.     {
  415.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  416.     }
  417.     if ( s_ivo.driver != s_graphicsoptions.driver.curvalue )
  418.     {
  419.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  420.     }
  421.     if ( s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue )
  422.     {
  423.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  424.     }
  425.     if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue )
  426.     {
  427.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  428.     }
  429.     if ( s_ivo.filter != s_graphicsoptions.filter.curvalue )
  430.     {
  431.         s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
  432.     }
  433.  
  434.     GraphicsOptions_CheckConfig();
  435. }    
  436.  
  437. /*
  438. =================
  439. GraphicsOptions_ApplyChanges
  440. =================
  441. */
  442. static void GraphicsOptions_ApplyChanges( void *unused, int notification )
  443. {
  444.     if (notification != QM_ACTIVATED)
  445.         return;
  446.  
  447.     switch ( s_graphicsoptions.texturebits.curvalue  )
  448.     {
  449.     case 0:
  450.         trap_Cvar_SetValue( "r_texturebits", 0 );
  451.         break;
  452.     case 1:
  453.         trap_Cvar_SetValue( "r_texturebits", 16 );
  454.         break;
  455.     case 2:
  456.         trap_Cvar_SetValue( "r_texturebits", 32 );
  457.         break;
  458.     }
  459.     trap_Cvar_SetValue( "r_picmip", 3 - s_graphicsoptions.tq.curvalue );
  460.     trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue );
  461.     trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue );
  462.     trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue );
  463.     trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] );
  464.     switch ( s_graphicsoptions.colordepth.curvalue )
  465.     {
  466.     case 0:
  467.         trap_Cvar_SetValue( "r_colorbits", 0 );
  468.         trap_Cvar_SetValue( "r_depthbits", 0 );
  469.         trap_Cvar_SetValue( "r_stencilbits", 0 );
  470.         break;
  471.     case 1:
  472.         trap_Cvar_SetValue( "r_colorbits", 16 );
  473.         trap_Cvar_SetValue( "r_depthbits", 16 );
  474.         trap_Cvar_SetValue( "r_stencilbits", 0 );
  475.         break;
  476.     case 2:
  477.         trap_Cvar_SetValue( "r_colorbits", 32 );
  478.         trap_Cvar_SetValue( "r_depthbits", 24 );
  479.         break;
  480.     }
  481.     trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
  482.  
  483.     if ( s_graphicsoptions.geometry.curvalue == 2 )
  484.     {
  485.         trap_Cvar_SetValue( "r_lodBias", 0 );
  486.         trap_Cvar_SetValue( "r_subdivisions", 4 );
  487.     }
  488.     else if ( s_graphicsoptions.geometry.curvalue == 1 )
  489.     {
  490.         trap_Cvar_SetValue( "r_lodBias", 1 );
  491.         trap_Cvar_SetValue( "r_subdivisions", 12 );
  492.     }
  493.     else
  494.     {
  495.         trap_Cvar_SetValue( "r_lodBias", 1 );
  496.         trap_Cvar_SetValue( "r_subdivisions", 20 );
  497.     }
  498.  
  499.     if ( s_graphicsoptions.filter.curvalue )
  500.     {
  501.         trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" );
  502.     }
  503.     else
  504.     {
  505.         trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" );
  506.     }
  507.  
  508.     trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
  509. }
  510.  
  511. /*
  512. =================
  513. GraphicsOptions_Event
  514. =================
  515. */
  516. static void GraphicsOptions_Event( void* ptr, int event ) {
  517.     InitialVideoOptions_s *ivo;
  518.  
  519.     if( event != QM_ACTIVATED ) {
  520.          return;
  521.     }
  522.  
  523.     switch( ((menucommon_s*)ptr)->id ) {
  524.     case ID_MODE:
  525.         // clamp 3dfx video modes
  526.         if ( s_graphicsoptions.driver.curvalue == 1 )
  527.         {
  528.             if ( s_graphicsoptions.mode.curvalue < 2 )
  529.                 s_graphicsoptions.mode.curvalue = 2;
  530.             else if ( s_graphicsoptions.mode.curvalue > 6 )
  531.                 s_graphicsoptions.mode.curvalue = 6;
  532.         }
  533.         break;
  534.  
  535.     case ID_LIST:
  536.         ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue];
  537.  
  538.         s_graphicsoptions.mode.curvalue        = ivo->mode;
  539.         s_graphicsoptions.tq.curvalue          = ivo->tq;
  540.         s_graphicsoptions.lighting.curvalue    = ivo->lighting;
  541.         s_graphicsoptions.colordepth.curvalue  = ivo->colordepth;
  542.         s_graphicsoptions.texturebits.curvalue = ivo->texturebits;
  543.         s_graphicsoptions.geometry.curvalue    = ivo->geometry;
  544.         s_graphicsoptions.filter.curvalue      = ivo->filter;
  545.         s_graphicsoptions.fs.curvalue          = ivo->fullscreen;
  546.         break;
  547.  
  548.     case ID_DRIVERINFO:
  549.         UI_DriverInfo_Menu();
  550.         break;
  551.  
  552.     case ID_BACK2:
  553.         UI_PopMenu();
  554.         break;
  555.  
  556.     case ID_GRAPHICS:
  557.         break;
  558.  
  559.     case ID_DISPLAY:
  560.         UI_PopMenu();
  561.         UI_DisplayOptionsMenu();
  562.         break;
  563.  
  564.     case ID_SOUND:
  565.         UI_PopMenu();
  566.         UI_SoundOptionsMenu();
  567.         break;
  568.  
  569.     case ID_NETWORK:
  570.         UI_PopMenu();
  571.         UI_NetworkOptionsMenu();
  572.         break;
  573.     }
  574. }
  575.  
  576.  
  577. /*
  578. ================
  579. GraphicsOptions_TQEvent
  580. ================
  581. */
  582. static void GraphicsOptions_TQEvent( void *ptr, int event ) {
  583.     if( event != QM_ACTIVATED ) {
  584.          return;
  585.     }
  586.     s_graphicsoptions.tq.curvalue = (int)(s_graphicsoptions.tq.curvalue + 0.5);
  587. }
  588.  
  589.  
  590. /*
  591. ================
  592. GraphicsOptions_MenuDraw
  593. ================
  594. */
  595. void GraphicsOptions_MenuDraw (void)
  596. {
  597. //APSFIX - rework this
  598.     GraphicsOptions_UpdateMenuItems();
  599.  
  600.     Menu_Draw( &s_graphicsoptions.menu );
  601. }
  602.  
  603. /*
  604. =================
  605. GraphicsOptions_SetMenuItems
  606. =================
  607. */
  608. static void GraphicsOptions_SetMenuItems( void )
  609. {
  610.     s_graphicsoptions.mode.curvalue = trap_Cvar_VariableValue( "r_mode" );
  611.     if ( s_graphicsoptions.mode.curvalue < 0 )
  612.     {
  613.         s_graphicsoptions.mode.curvalue = 3;
  614.     }
  615.     s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen");
  616.     s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions");
  617.     s_graphicsoptions.tq.curvalue = 3-trap_Cvar_VariableValue( "r_picmip");
  618.     if ( s_graphicsoptions.tq.curvalue < 0 )
  619.     {
  620.         s_graphicsoptions.tq.curvalue = 0;
  621.     }
  622.     else if ( s_graphicsoptions.tq.curvalue > 3 )
  623.     {
  624.         s_graphicsoptions.tq.curvalue = 3;
  625.     }
  626.  
  627.     s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0;
  628.     switch ( ( int ) trap_Cvar_VariableValue( "r_texturebits" ) )
  629.     {
  630.     default:
  631.     case 0:
  632.         s_graphicsoptions.texturebits.curvalue = 0;
  633.         break;
  634.     case 16:
  635.         s_graphicsoptions.texturebits.curvalue = 1;
  636.         break;
  637.     case 32:
  638.         s_graphicsoptions.texturebits.curvalue = 2;
  639.         break;
  640.     }
  641.  
  642.     if ( !Q_stricmp( UI_Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) )
  643.     {
  644.         s_graphicsoptions.filter.curvalue = 0;
  645.     }
  646.     else
  647.     {
  648.         s_graphicsoptions.filter.curvalue = 1;
  649.     }
  650.  
  651.     if ( trap_Cvar_VariableValue( "r_lodBias" ) > 0 )
  652.     {
  653.         if ( trap_Cvar_VariableValue( "r_subdivisions" ) >= 20 )
  654.         {
  655.             s_graphicsoptions.geometry.curvalue = 0;
  656.         }
  657.         else
  658.         {
  659.             s_graphicsoptions.geometry.curvalue = 1;
  660.         }
  661.     }
  662.     else
  663.     {
  664.         s_graphicsoptions.geometry.curvalue = 2;
  665.     }
  666.  
  667.     switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) )
  668.     {
  669.     default:
  670.     case 0:
  671.         s_graphicsoptions.colordepth.curvalue = 0;
  672.         break;
  673.     case 16:
  674.         s_graphicsoptions.colordepth.curvalue = 1;
  675.         break;
  676.     case 32:
  677.         s_graphicsoptions.colordepth.curvalue = 2;
  678.         break;
  679.     }
  680.  
  681.     if ( s_graphicsoptions.fs.curvalue == 0 )
  682.     {
  683.         s_graphicsoptions.colordepth.curvalue = 0;
  684.     }
  685.     if ( s_graphicsoptions.driver.curvalue == 1 )
  686.     {
  687.         s_graphicsoptions.colordepth.curvalue = 1;
  688.     }
  689. }
  690.  
  691. /*
  692. ================
  693. GraphicsOptions_MenuInit
  694. ================
  695. */
  696. void GraphicsOptions_MenuInit( void )
  697. {
  698.     static const char *s_driver_names[] =
  699.     {
  700.         "Default",
  701.         "Voodoo",
  702.         0
  703.     };
  704.  
  705.     static const char *tq_names[] =
  706.     {
  707.         "Default",
  708.         "16 bit",
  709.         "32 bit",
  710.         0
  711.     };
  712.  
  713.     static const char *s_graphics_options_names[] =
  714.     {
  715.         "High Quality",
  716.         "Normal",
  717.         "Fast",
  718.         "Fastest",
  719.         "Custom",
  720.         0
  721.     };
  722.  
  723.     static const char *lighting_names[] =
  724.     {
  725.         "Lightmap",
  726.         "Vertex",
  727.         0
  728.     };
  729.  
  730.     static const char *colordepth_names[] =
  731.     {
  732.         "Default",
  733.         "16 bit",
  734.         "32 bit",
  735.         0
  736.     };
  737.  
  738.     static const char *resolutions[] = 
  739.     {
  740.         "320x240",
  741.         "400x300",
  742.         "512x384",
  743.         "640x480",
  744.         "800x600",
  745.         "960x720",
  746.         "1024x768",
  747.         "1152x864",
  748.         "1280x1024",
  749.         "1600x1200",
  750.         "2048x1536",
  751.         "856x480 wide screen",
  752.         0
  753.     };
  754.     static const char *filter_names[] =
  755.     {
  756.         "Bilinear",
  757.         "Trilinear",
  758.         0
  759.     };
  760.     static const char *quality_names[] =
  761.     {
  762.         "Low",
  763.         "Medium",
  764.         "High",
  765.         0
  766.     };
  767.     static const char *enabled_names[] =
  768.     {
  769.         "Off",
  770.         "On",
  771.         0
  772.     };
  773.  
  774.     int y;
  775.  
  776.     // zero set all our globals
  777.     memset( &s_graphicsoptions, 0 ,sizeof(graphicsoptions_t) );
  778.  
  779.     GraphicsOptions_Cache();
  780.  
  781.     s_graphicsoptions.menu.wrapAround = qtrue;
  782.     s_graphicsoptions.menu.fullscreen = qtrue;
  783.     s_graphicsoptions.menu.draw       = GraphicsOptions_MenuDraw;
  784.  
  785.     s_graphicsoptions.banner.generic.type  = MTYPE_BTEXT;
  786.     s_graphicsoptions.banner.generic.x       = 320;
  787.     s_graphicsoptions.banner.generic.y       = 16;
  788.     s_graphicsoptions.banner.string         = "SYSTEM SETUP";
  789.     s_graphicsoptions.banner.color         = color_white;
  790.     s_graphicsoptions.banner.style         = UI_CENTER;
  791.  
  792.     s_graphicsoptions.framel.generic.type  = MTYPE_BITMAP;
  793.     s_graphicsoptions.framel.generic.name  = GRAPHICSOPTIONS_FRAMEL;
  794.     s_graphicsoptions.framel.generic.flags = QMF_INACTIVE;
  795.     s_graphicsoptions.framel.generic.x       = 0;
  796.     s_graphicsoptions.framel.generic.y       = 78;
  797.     s_graphicsoptions.framel.width         = 256;
  798.     s_graphicsoptions.framel.height         = 329;
  799.  
  800.     s_graphicsoptions.framer.generic.type  = MTYPE_BITMAP;
  801.     s_graphicsoptions.framer.generic.name  = GRAPHICSOPTIONS_FRAMER;
  802.     s_graphicsoptions.framer.generic.flags = QMF_INACTIVE;
  803.     s_graphicsoptions.framer.generic.x       = 376;
  804.     s_graphicsoptions.framer.generic.y       = 76;
  805.     s_graphicsoptions.framer.width         = 256;
  806.     s_graphicsoptions.framer.height         = 334;
  807.  
  808.     s_graphicsoptions.graphics.generic.type        = MTYPE_PTEXT;
  809.     s_graphicsoptions.graphics.generic.flags    = QMF_RIGHT_JUSTIFY;
  810.     s_graphicsoptions.graphics.generic.id        = ID_GRAPHICS;
  811.     s_graphicsoptions.graphics.generic.callback    = GraphicsOptions_Event;
  812.     s_graphicsoptions.graphics.generic.x        = 216;
  813.     s_graphicsoptions.graphics.generic.y        = 240 - 2 * PROP_HEIGHT;
  814.     s_graphicsoptions.graphics.string            = "GRAPHICS";
  815.     s_graphicsoptions.graphics.style            = UI_RIGHT;
  816.     s_graphicsoptions.graphics.color            = color_red;
  817.  
  818.     s_graphicsoptions.display.generic.type        = MTYPE_PTEXT;
  819.     s_graphicsoptions.display.generic.flags        = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
  820.     s_graphicsoptions.display.generic.id        = ID_DISPLAY;
  821.     s_graphicsoptions.display.generic.callback    = GraphicsOptions_Event;
  822.     s_graphicsoptions.display.generic.x            = 216;
  823.     s_graphicsoptions.display.generic.y            = 240 - PROP_HEIGHT;
  824.     s_graphicsoptions.display.string            = "DISPLAY";
  825.     s_graphicsoptions.display.style                = UI_RIGHT;
  826.     s_graphicsoptions.display.color                = color_red;
  827.  
  828.     s_graphicsoptions.sound.generic.type        = MTYPE_PTEXT;
  829.     s_graphicsoptions.sound.generic.flags        = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
  830.     s_graphicsoptions.sound.generic.id            = ID_SOUND;
  831.     s_graphicsoptions.sound.generic.callback    = GraphicsOptions_Event;
  832.     s_graphicsoptions.sound.generic.x            = 216;
  833.     s_graphicsoptions.sound.generic.y            = 240;
  834.     s_graphicsoptions.sound.string                = "SOUND";
  835.     s_graphicsoptions.sound.style                = UI_RIGHT;
  836.     s_graphicsoptions.sound.color                = color_red;
  837.  
  838.     s_graphicsoptions.network.generic.type        = MTYPE_PTEXT;
  839.     s_graphicsoptions.network.generic.flags        = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
  840.     s_graphicsoptions.network.generic.id        = ID_NETWORK;
  841.     s_graphicsoptions.network.generic.callback    = GraphicsOptions_Event;
  842.     s_graphicsoptions.network.generic.x            = 216;
  843.     s_graphicsoptions.network.generic.y            = 240 + PROP_HEIGHT;
  844.     s_graphicsoptions.network.string            = "NETWORK";
  845.     s_graphicsoptions.network.style                = UI_RIGHT;
  846.     s_graphicsoptions.network.color                = color_red;
  847.  
  848.     y = 240 - 6 * (BIGCHAR_HEIGHT + 2);
  849.     s_graphicsoptions.list.generic.type     = MTYPE_SPINCONTROL;
  850.     s_graphicsoptions.list.generic.name     = "Graphics Settings:";
  851.     s_graphicsoptions.list.generic.flags    = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  852.     s_graphicsoptions.list.generic.x        = 400;
  853.     s_graphicsoptions.list.generic.y        = y;
  854.     s_graphicsoptions.list.generic.callback = GraphicsOptions_Event;
  855.     s_graphicsoptions.list.generic.id       = ID_LIST;
  856.     s_graphicsoptions.list.itemnames        = s_graphics_options_names;
  857.     y += 2 * ( BIGCHAR_HEIGHT + 2 );
  858.  
  859.     s_graphicsoptions.driver.generic.type  = MTYPE_SPINCONTROL;
  860.     s_graphicsoptions.driver.generic.name  = "GL Driver:";
  861.     s_graphicsoptions.driver.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  862.     s_graphicsoptions.driver.generic.x     = 400;
  863.     s_graphicsoptions.driver.generic.y     = y;
  864.     s_graphicsoptions.driver.itemnames     = s_driver_names;
  865.     s_graphicsoptions.driver.curvalue      = (uis.glconfig.driverType == GLDRV_VOODOO);
  866.     y += BIGCHAR_HEIGHT+2;
  867.  
  868.     // references/modifies "r_allowExtensions"
  869.     s_graphicsoptions.allow_extensions.generic.type     = MTYPE_SPINCONTROL;
  870.     s_graphicsoptions.allow_extensions.generic.name        = "GL Extensions:";
  871.     s_graphicsoptions.allow_extensions.generic.flags    = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  872.     s_graphicsoptions.allow_extensions.generic.x        = 400;
  873.     s_graphicsoptions.allow_extensions.generic.y        = y;
  874.     s_graphicsoptions.allow_extensions.itemnames        = enabled_names;
  875.     y += BIGCHAR_HEIGHT+2;
  876.  
  877.     // references/modifies "r_mode"
  878.     s_graphicsoptions.mode.generic.type     = MTYPE_SPINCONTROL;
  879.     s_graphicsoptions.mode.generic.name     = "Video Mode:";
  880.     s_graphicsoptions.mode.generic.flags    = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  881.     s_graphicsoptions.mode.generic.x        = 400;
  882.     s_graphicsoptions.mode.generic.y        = y;
  883.     s_graphicsoptions.mode.itemnames        = resolutions;
  884.     s_graphicsoptions.mode.generic.callback = GraphicsOptions_Event;
  885.     s_graphicsoptions.mode.generic.id       = ID_MODE;
  886.     y += BIGCHAR_HEIGHT+2;
  887.  
  888.     // references "r_colorbits"
  889.     s_graphicsoptions.colordepth.generic.type     = MTYPE_SPINCONTROL;
  890.     s_graphicsoptions.colordepth.generic.name     = "Color Depth:";
  891.     s_graphicsoptions.colordepth.generic.flags    = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  892.     s_graphicsoptions.colordepth.generic.x        = 400;
  893.     s_graphicsoptions.colordepth.generic.y        = y;
  894.     s_graphicsoptions.colordepth.itemnames        = colordepth_names;
  895.     y += BIGCHAR_HEIGHT+2;
  896.  
  897.     // references/modifies "r_fullscreen"
  898.     s_graphicsoptions.fs.generic.type     = MTYPE_SPINCONTROL;
  899.     s_graphicsoptions.fs.generic.name      = "Fullscreen:";
  900.     s_graphicsoptions.fs.generic.flags      = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  901.     s_graphicsoptions.fs.generic.x          = 400;
  902.     s_graphicsoptions.fs.generic.y          = y;
  903.     s_graphicsoptions.fs.itemnames          = enabled_names;
  904.     y += BIGCHAR_HEIGHT+2;
  905.  
  906.     // references/modifies "r_vertexLight"
  907.     s_graphicsoptions.lighting.generic.type  = MTYPE_SPINCONTROL;
  908.     s_graphicsoptions.lighting.generic.name     = "Lighting:";
  909.     s_graphicsoptions.lighting.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  910.     s_graphicsoptions.lighting.generic.x     = 400;
  911.     s_graphicsoptions.lighting.generic.y     = y;
  912.     s_graphicsoptions.lighting.itemnames     = lighting_names;
  913.     y += BIGCHAR_HEIGHT+2;
  914.  
  915.     // references/modifies "r_lodBias" & "subdivisions"
  916.     s_graphicsoptions.geometry.generic.type  = MTYPE_SPINCONTROL;
  917.     s_graphicsoptions.geometry.generic.name     = "Geometric Detail:";
  918.     s_graphicsoptions.geometry.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  919.     s_graphicsoptions.geometry.generic.x     = 400;
  920.     s_graphicsoptions.geometry.generic.y     = y;
  921.     s_graphicsoptions.geometry.itemnames     = quality_names;
  922.     y += BIGCHAR_HEIGHT+2;
  923.  
  924.     // references/modifies "r_picmip"
  925.     s_graphicsoptions.tq.generic.type    = MTYPE_SLIDER;
  926.     s_graphicsoptions.tq.generic.name    = "Texture Detail:";
  927.     s_graphicsoptions.tq.generic.flags    = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  928.     s_graphicsoptions.tq.generic.x        = 400;
  929.     s_graphicsoptions.tq.generic.y        = y;
  930.     s_graphicsoptions.tq.minvalue       = 0;
  931.     s_graphicsoptions.tq.maxvalue       = 3;
  932.     s_graphicsoptions.tq.generic.callback = GraphicsOptions_TQEvent;
  933.     y += BIGCHAR_HEIGHT+2;
  934.  
  935.     // references/modifies "r_textureBits"
  936.     s_graphicsoptions.texturebits.generic.type  = MTYPE_SPINCONTROL;
  937.     s_graphicsoptions.texturebits.generic.name    = "Texture Quality:";
  938.     s_graphicsoptions.texturebits.generic.flags    = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  939.     s_graphicsoptions.texturebits.generic.x        = 400;
  940.     s_graphicsoptions.texturebits.generic.y        = y;
  941.     s_graphicsoptions.texturebits.itemnames     = tq_names;
  942.     y += BIGCHAR_HEIGHT+2;
  943.  
  944.     // references/modifies "r_textureMode"
  945.     s_graphicsoptions.filter.generic.type   = MTYPE_SPINCONTROL;
  946.     s_graphicsoptions.filter.generic.name    = "Texture Filter:";
  947.     s_graphicsoptions.filter.generic.flags    = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
  948.     s_graphicsoptions.filter.generic.x        = 400;
  949.     s_graphicsoptions.filter.generic.y        = y;
  950.     s_graphicsoptions.filter.itemnames      = filter_names;
  951.     y += 2*BIGCHAR_HEIGHT;
  952.  
  953.     s_graphicsoptions.driverinfo.generic.type     = MTYPE_PTEXT;
  954.     s_graphicsoptions.driverinfo.generic.flags    = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
  955.     s_graphicsoptions.driverinfo.generic.callback = GraphicsOptions_Event;
  956.     s_graphicsoptions.driverinfo.generic.id       = ID_DRIVERINFO;
  957.     s_graphicsoptions.driverinfo.generic.x        = 320;
  958.     s_graphicsoptions.driverinfo.generic.y        = y;
  959.     s_graphicsoptions.driverinfo.string           = "Driver Info";
  960.     s_graphicsoptions.driverinfo.style            = UI_CENTER|UI_SMALLFONT;
  961.     s_graphicsoptions.driverinfo.color            = color_red;
  962.     y += BIGCHAR_HEIGHT+2;
  963.  
  964.     s_graphicsoptions.back.generic.type        = MTYPE_BITMAP;
  965.     s_graphicsoptions.back.generic.name     = GRAPHICSOPTIONS_BACK0;
  966.     s_graphicsoptions.back.generic.flags    = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
  967.     s_graphicsoptions.back.generic.callback = GraphicsOptions_Event;
  968.     s_graphicsoptions.back.generic.id        = ID_BACK2;
  969.     s_graphicsoptions.back.generic.x        = 0;
  970.     s_graphicsoptions.back.generic.y        = 480-64;
  971.     s_graphicsoptions.back.width              = 128;
  972.     s_graphicsoptions.back.height              = 64;
  973.     s_graphicsoptions.back.focuspic         = GRAPHICSOPTIONS_BACK1;
  974.  
  975.     s_graphicsoptions.apply.generic.type     = MTYPE_BITMAP;
  976.     s_graphicsoptions.apply.generic.name     = GRAPHICSOPTIONS_ACCEPT0;
  977.     s_graphicsoptions.apply.generic.flags    = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_HIDDEN|QMF_INACTIVE;
  978.     s_graphicsoptions.apply.generic.callback = GraphicsOptions_ApplyChanges;
  979.     s_graphicsoptions.apply.generic.x        = 640;
  980.     s_graphicsoptions.apply.generic.y        = 480-64;
  981.     s_graphicsoptions.apply.width               = 128;
  982.     s_graphicsoptions.apply.height           = 64;
  983.     s_graphicsoptions.apply.focuspic         = GRAPHICSOPTIONS_ACCEPT1;
  984.  
  985.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.banner );
  986.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.framel );
  987.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.framer );
  988.  
  989.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.graphics );
  990.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.display );
  991.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.sound );
  992.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.network );
  993.  
  994.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.list );
  995.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.driver );
  996.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.allow_extensions );
  997.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.mode );
  998.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.colordepth );
  999.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.fs );
  1000.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting );
  1001.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry );
  1002.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.tq );
  1003.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.texturebits );
  1004.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.filter );
  1005.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.driverinfo );
  1006.  
  1007.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.back );
  1008.     Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.apply );
  1009.  
  1010.     GraphicsOptions_SetMenuItems();
  1011.     GraphicsOptions_GetInitialVideo();
  1012.  
  1013.     if ( uis.glconfig.driverType == GLDRV_ICD &&
  1014.          uis.glconfig.hardwareType == GLHW_3DFX_2D3D )
  1015.     {
  1016.         s_graphicsoptions.driver.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
  1017.     }
  1018. }
  1019.  
  1020.  
  1021. /*
  1022. =================
  1023. GraphicsOptions_Cache
  1024. =================
  1025. */
  1026. void GraphicsOptions_Cache( void ) {
  1027.     trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_FRAMEL );
  1028.     trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_FRAMER );
  1029.     trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_BACK0 );
  1030.     trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_BACK1 );
  1031.     trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_ACCEPT0 );
  1032.     trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_ACCEPT1 );
  1033. }
  1034.  
  1035.  
  1036. /*
  1037. =================
  1038. UI_GraphicsOptionsMenu
  1039. =================
  1040. */
  1041. void UI_GraphicsOptionsMenu( void ) {
  1042.     GraphicsOptions_MenuInit();
  1043.     UI_PushMenu( &s_graphicsoptions.menu );
  1044.     Menu_SetCursorToItem( &s_graphicsoptions.menu, &s_graphicsoptions.graphics );
  1045. }
  1046.  
  1047.